import 'package:flutter/material.dart';

void main() => runApp(LoginApp());

class LoginApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  FocusNode focusNode1 = new FocusNode();
  FocusNode focusNode2 = new FocusNode();
  FocusScopeNode focusScopeNode;

  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      title: '登录',
      home: Scaffold(
        appBar: AppBar(
          title: Text('登录页面'),
          backgroundColor: Colors.red,
          centerTitle: true,
          toolbarOpacity: 0.5,
        ),
        body: Center(
          child:  Padding(
            padding: EdgeInsets.all(15),
            child: Container(
              margin: EdgeInsets.only(left: 30, right: 30),
              padding: EdgeInsets.only(left: 30.0, top: 40.0, right: 30.0, bottom: 0.0),
              decoration: BoxDecoration(
                  color: Colors.black26,
                  borderRadius: BorderRadius.all(Radius.circular(5))
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  Text(
                    '登录',
                    style: TextStyle(
                        fontSize: 30
                    ),
                  ),
                  TextField(
                    focusNode: focusNode1,
                    decoration: InputDecoration(
                        hintText: '请输入账号',
                        icon: Image.asset(
                          'image/icon_account.png',
                          width: 20,
                          height: 20,
                        )
                    ),
                  ),
                  TextField(
                    focusNode: focusNode2,
                    obscureText: true,
                    keyboardType: TextInputType.numberWithOptions(
                        signed: true,
                        decimal: true
                    ),
                    decoration: InputDecoration(
                        hintText: '请输入密码',
                        icon: Image.asset(
                          'image/icon_password.png',
                          width: 20,
                          height: 20,
                        )
                    ),
                  ),
                  Padding(
                    padding: EdgeInsets.all(10),
                  ),
                  RaisedButton(
                    child: Text('登录'),
                    color: Colors.redAccent,
                    textColor: Colors.white,
                    onPressed: () {

                    },
                  ),
                  Padding(
                    padding: EdgeInsets.all(20),
                  ),
                  Row(
                    children: <Widget>[
                      Text(
                        '忘记密码',
                        style: TextStyle(
                            color: Colors.blueAccent,
                            fontSize: 13
                        ),
                      ),
                      Expanded(
                        child: Text(''),
                      ),
                      Text(
                        '注册',
                        style: TextStyle(
                            color: Colors.blueAccent,
                            fontSize: 13
                        ),
                      ),
                    ],
                  )
                ],
              ),
            ),
          ),
        )
      )
    );
  }
}
